package com.jiu.http.webqq;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

public class Result {
    private String pollType;//group_message
    private Map<String,Object> value;//
    private String msgId;//
    private String fromUin;//
    private String toUin;//245880172
    private String msgId2;//563508
    private String msgType;//43
    private String replyIp;//181147415
    private String groupCode;//1400360467
    private String sendUin;//2946289439
    private String seq;//94680
    private Integer time;//1388107024
    private String infoSeq;//215418773
    private List<Object> content;//
    private Map<String,Object> font;
    private Integer size;//9
    private String color;
    private List<Object> style;
    private String fontName;
    private String text;
    private String qq;
    private String name;
    @SuppressWarnings("unchecked")
	public Result(Map<String,Object> result){
    	if(result.get("poll_type")!=null)this.pollType =  result.get("poll_type").toString();
    	if(result.get("value")!=null){
    		this.value = (Map<String, Object>) result.get("value");
    		if(value.get("msg_id")!=null)this.msgId =  value.get("msg_id").toString();
    		if(value.get("from_uin")!=null)this.fromUin =  value.get("from_uin").toString();
    		if(value.get("to_uin")!=null)this.toUin =  value.get("to_uin").toString();
    		if(value.get("msg_id2")!=null)this.msgId2 =  value.get("msg_id2").toString();
    		if(value.get("msg_type")!=null)this.msgType =  value.get("msg_type").toString();
    		if(value.get("reply_ip")!=null)this.replyIp =  value.get("reply_ip").toString();
    		if(value.get("group_code")!=null)this.groupCode =  value.get("group_code").toString();
    		if(value.get("send_uin")!=null)this.sendUin =  value.get("send_uin").toString();
    		if(value.get("seq")!=null)this.seq =  value.get("seq").toString();
    		if(value.get("time")!=null)this.time = (Integer) value.get("time");
    		if(value.get("info_seq")!=null)this.infoSeq =  value.get("info_seq").toString();
    		if(value.get("content")!=null){
    			this.content = (List<Object>) value.get("content"); 
    			List<Object> c0 = (List<Object>) content.get(0);
    			this.font = (Map<String, Object>) c0.get(1);
    			this.style = (List<Object>) font.get("style");
    			this.color =  font.get("color").toString();
    			this.fontName =  font.get("name").toString();
    			this.size = (Integer) font.get("size");
    			String alltext = Arrays.toString(content.subList(1, content.size()).toArray());
    			this.text = alltext.substring(1,alltext.length()-1);
    		}
    		
    	}
    	
    	
    }
	public String getPollType() {
		return pollType;
	}
	public void setPollType(String pollType) {
		this.pollType = pollType;
	}
	public Map<String, Object> getValue() {
		return value;
	}
	public void setValue(Map<String, Object> value) {
		this.value = value;
	}
	public String getMsgId() {
		return msgId;
	}
	public void setMsgId(String msgId) {
		this.msgId = msgId;
	}
	
	public String getFromUin() {
	    return fromUin;
	}
	public void setFromUin(String fromUin) {
	    this.fromUin = fromUin;
	}
	public String getToUin() {
		return toUin;
	}
	public void setToUin(String toUin) {
		this.toUin = toUin;
	}
	public String getMsgId2() {
		return msgId2;
	}
	public void setMsgId2(String msgId2) {
		this.msgId2 = msgId2;
	}
	public String getMsgType() {
		return msgType;
	}
	public void setMsgType(String msgType) {
		this.msgType = msgType;
	}
	public String getReplyIp() {
		return replyIp;
	}
	public void setReplyIp(String replyIp) {
		this.replyIp = replyIp;
	}
	public String getGroupCode() {
		return groupCode;
	}
	public void setGroupCode(String groupCode) {
		this.groupCode = groupCode;
	}
	public String getSendUin() {
		return sendUin;
	}
	public void setSendUin(String sendUin) {
		this.sendUin = sendUin;
	}
	public String getSeq() {
		return seq;
	}
	public void setSeq(String seq) {
		this.seq = seq;
	}
	public Integer getTime() {
		return time;
	}
	public void setTime(Integer time) {
		this.time = time;
	}
	public String getInfoSeq() {
		return infoSeq;
	}
	public void setInfoSeq(String infoSeq) {
		this.infoSeq = infoSeq;
	}
	public List<Object> getContent() {
		return content;
	}
	public void setContent(List<Object> content) {
		this.content = content;
	}
	public Map<String, Object> getFont() {
		return font;
	}
	public void setFont(Map<String, Object> font) {
		this.font = font;
	}
	public Integer getSize() {
		return size;
	}
	public void setSize(Integer size) {
		this.size = size;
	}
	public String getColor() {
		return color;
	}
	public void setColor(String color) {
		this.color = color;
	}
	public List<Object> getStyle() {
		return style;
	}
	public void setStyle(List<Object> style) {
		this.style = style;
	}

	public String getText() {
		return text;
	}
	public void setText(String text) {
		this.text = text;
	}
	public String getFontName() {
		return fontName;
	}
	public void setFontName(String fontName) {
		this.fontName = fontName;
	}
	public String getQq() {
		return qq;
	}
	public void setQq(String qq) {
		this.qq = qq;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	@Override
	public String toString() {
		return "Result [pollType=" + pollType + ", value=" + value + ", msgId="
				+ msgId + ", fromUin=" + fromUin + ", toUin=" + toUin
				+ ", msgId2=" + msgId2 + ", msgType=" + msgType + ", replyIp="
				+ replyIp + ", groupCode=" + groupCode + ", sendUin=" + sendUin
				+ ", seq=" + seq + ", time=" + time + ", infoSeq=" + infoSeq
				+ ", content=" + content + ", font=" + font + ", size=" + size
				+ ", color=" + color + ", style=" + style + ", fontName="
				+ fontName + ", text=" + text + ", qq=" + qq + ", name=" + name
				+ "]";
	}

	

   

	
}
